﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Medianamik.Core.Interfaces;

namespace Medianamik.Core
{
    public class NodeWrapper : INode, INodeWrapper
    {
        #region INodeWrapper Members

        private Node _innerNode;
        public Node InnerNode
        {
            get
            {
                return _innerNode;
            }
            set
            {
                if(value == null)
                {
                    throw new ArgumentNullException("InnerNode");
                }
                _innerNode = value;
                _innerNode.NamePropertyId = this.NamePropertyId;
            }
        }

        #endregion

        #region INode Members

        public NodeInstance AddNodeInstance(string pCultureName)
        {
            return InnerNode.AddNodeInstance(pCultureName);
        }

        public IEnumerable<Breadcrumb> Breadcrumbs
        {
            get { return InnerNode.Breadcrumbs; }
        }

        public virtual bool CanHaveChildNodes
        {
            get { return InnerNode.CanHaveChildNodes; }
        }

        public int ChildNodeCount
        {
            get { return InnerNode.ChildNodeCount; ; }
        }

        public DateTime CreatedOn
        {
            get { return InnerNode.CreatedOn; }
        }

        public virtual System.Globalization.CultureInfo DefaultCulture
        {
            get
            {
                return InnerNode.DefaultCulture;
            }
            set
            {
                InnerNode.DefaultCulture = value;
            }
        }

        public NodeInstance DefaultInstance
        {
            get { return InnerNode.DefaultInstance; }
        }

        public int Depth
        {
            get { return InnerNode.Depth; }
        }

        public virtual string DisplayName
        {
            get { return InnerNode.DisplayName; }
        }

        public IEnumerable<Node> GetChildContentNodes(System.Globalization.CultureInfo pCulture, bool inclusive)
        {
            return InnerNode.GetChildContentNodes(pCulture, inclusive); 
        }

        public IEnumerable<Node> GetChildContentNodes(System.Globalization.CultureInfo pCulture)
        {
            return InnerNode.GetChildContentNodes(pCulture); 
        }

        public IDictionary<string, T> GetValues<T>(string propertyName)
        {
            return InnerNode.GetValues<T>(propertyName); 
        }

        public bool HasChildren
        {
            get { return InnerNode.HasChildren; }
        }

        public bool HasInstanceForCurrentEditionCulture
        {
            get { return InnerNode.HasInstanceForCurrentEditionCulture; }
        }

        public bool HasName
        {
            get { return InnerNode.HasName; }
        }

        public Guid ID
        {
            get { return InnerNode.ID; }
        }

        public System.Collections.ObjectModel.ReadOnlyCollection<Medianamik.Core.Security.InheritedPermission> InheritedPermissions
        {
            get { return InnerNode.InheritedPermissions; }
        }

        public ReadOnlyNodeInstanceCollection Instances
        {
            get { return InnerNode.Instances; }
        }

        public bool InstancesLoaded
        {
            get { return InnerNode.InstancesLoaded; }
        }

        public bool IsDraft
        {
            get { return InnerNode.IsDraft; }
        }

        public bool IsParentOf(Node pParentNode)
        {
            return InnerNode.IsParentOf(pParentNode);
        }

        public System.Collections.ObjectModel.Collection<NodeType> LegitimateChildTypes
        {
            get { return InnerNode.LegitimateChildTypes; }
        }

        public long LongPosition
        {
            get { return InnerNode.LongPosition; }
        }

        public bool MayBeMoveTo(Guid? pParentNodeId)
        {
            return InnerNode.MayBeMoveTo(pParentNodeId);
        }

        public string Name
        {
            get
            {
                return InnerNode.Name;
            }
            set
            {
                InnerNode.Name = value;
            }
        }

        public virtual Guid NamePropertyId
        {
            get { return InnerNode.NamePropertyId; }
        }

        public NodeType NodeType
        {
            get { return InnerNode.NodeType; }
        }

        public virtual Guid NodeTypeID
        {
            get { return InnerNode.NodeTypeID; }
        }

        public Guid? ParentID
        {
            get { return InnerNode.ParentID; }
        }

        public Node ParentNode
        {
            get { return InnerNode.ParentNode; }
        }

        public IEnumerable<Node> ParentNodes
        {
            get { return InnerNode.ParentNodes; }
        }

        public string Path
        {
            get { return InnerNode.Path; }
        }

        public System.Collections.ObjectModel.ReadOnlyCollection<Security.Permission> Permissions
        {
            get { return InnerNode.Permissions; }
        }

        public short Position
        {
            get
            {
                return InnerNode.Position;
            }
            set
            {
                InnerNode.Position = value;
            }
        }

        public void RemoveNodeInstance(string pCultureName)
        {
            RemoveNodeInstance(pCultureName);
        }

        public bool RespectsNodeHierarchicalRules()
        {
            return InnerNode.RespectsNodeHierarchicalRules(); 
        }

        public bool RespectsTypeHierarchicalRules()
        {
            return InnerNode.RespectsTypeHierarchicalRules();
        }

        public NodeInstance this[System.Globalization.CultureInfo pCulture]
        {
            get { return InnerNode[pCulture]; }
        }

        public NodeInstance this[string pCultureName]
        {
            get { return InnerNode[pCultureName]; }
        }

        public bool UseInChildUrls
        {
            get { return InnerNode.UseInChildUrls; }
        }

        public virtual WebSite WebSite
        {
            get { return InnerNode.WebSite; }
        }

        public EntityStates Status
        {
            get
            {
                return InnerNode.Status;
            }
             set
            {
                InnerNode.Status = value;
            }
        }

        public bool IsLanguageNeutral
        {
            get { return InnerNode.IsLanguageNeutral; }
        }

        #endregion
    }
  
}
